#ifndef _dso_plugin_def_h
#define _dso_plugin_def_h

#include "dso_const.h"

#define setVBlank(x) (pluginLib->pluginSetVBlank)(pluginUniqueID,x)
#define clearVBlank() (pluginLib->pluginClearVBlank)(pluginUniqueID)
#define setDrawHook(x) (pluginLib->pluginSetDraw)(pluginUniqueID,x)
#define clearDrawHook() (pluginLib->pluginClearDraw)(pluginUniqueID)
#define hookIRQ (pluginLib->pluginSetIRQ)
#define unhookIRQ (pluginLib->pluginClearIRQ)
#define resetScreens (pluginLib->resetScreens)

#define debugPrint (pluginLib->debugPrint)
#define debugPrintHalt (pluginLib->debugPrintHalt)

#define calloc (pluginLib->calloc)
#define malloc (pluginLib->malloc)
#define free (pluginLib->free)
#define realloc (pluginLib->realloc)
	
#define sprintf (pluginLib->sprintf)
#define sscanf (pluginLib->sscanf)

#define rand (pluginLib->rand)

#define memchr (pluginLib->memchr)
#define memcmp (pluginLib->memcmp)
#define memcpy (pluginLib->memcpy)
#define memmove (pluginLib->memmove)
#define memset (pluginLib->memset)

#define abs (pluginLib->abs)
#define labs (pluginLib->labs)
#define llabs (pluginLib->llabs)
#define fabs (pluginLib->fabs)
#define fabsf (pluginLib->fabsf)

#define atof (pluginLib->atof)
#define atoi (pluginLib->atoi)
#define atol (pluginLib->atol)
#define atoll (pluginLib->atoll)

#define strcat (pluginLib->strcat)
#define strchr (pluginLib->strchr)
#define strcmp (pluginLib->strcmp)
#define strcoll (pluginLib->strcoll)
#define strcpy (pluginLib->strcpy)
#define strcspn (pluginLib->strcspn)
#define strdup (pluginLib->strdup)
#define strlen (pluginLib->strlen)
#define strncat (pluginLib->strncat)
#define strncmp (pluginLib->strncmp)
#define strncpy (pluginLib->strncpy)
#define strpbrk (pluginLib->strpbrk)
#define strrchr (pluginLib->strrchr)
#define strsep (pluginLib->strsep)
#define strspn (pluginLib->strspn)
#define strstr (pluginLib->strstr)
#define strtok (pluginLib->strtok)
#define strxfrm (pluginLib->strxfrm)
	
#define FAT_fopen (pluginLib->DRAGON_fopen)
#define FAT_fclose (pluginLib->DRAGON_fclose)
#define FAT_fseek (pluginLib->DRAGON_fseek)
#define FAT_ftell (pluginLib->DRAGON_ftell)
#define FAT_fread (pluginLib->DRAGON_fread)
#define FAT_fwrite (pluginLib->DRAGON_fwrite)
#define FAT_fgetc (pluginLib->DRAGON_fgetc)
#define FAT_fputc (pluginLib->DRAGON_fputc)
#define FAT_fgets (pluginLib->DRAGON_fgets)
#define FAT_fputs (pluginLib->DRAGON_fputs)
#define FAT_feof (pluginLib->DRAGON_feof)
	
#define FAT_FileExists (pluginLib->DRAGON_FileExists)
#define FAT_remove (pluginLib->DRAGON_remove)
#define FAT_mkdir (pluginLib->DRAGON_mkdir)
#define FAT_chdir (pluginLib->DRAGON_chdir)
#define FAT_rename (pluginLib->DRAGON_rename)
	
#define FAT_GetAlias (pluginLib->DRAGON_GetAlias)
#define FAT_GetLongFilename (pluginLib->DRAGON_GetLongFilename)
#define FAT_GetFileSize (pluginLib->DRAGON_GetFileSize)
#define FAT_GetFileCluster (pluginLib->DRAGON_GetFileCluster)
#define FAT_GetFileAttributes (pluginLib->DRAGON_GetFileAttributes)
#define FAT_SetFileAttributes (pluginLib->DRAGON_SetFileAttributes)
#define FAT_FindFirstFileLFN (pluginLib->DRAGON_FindFirstFileLFN)
#define FAT_FindNextFileLFN (pluginLib->DRAGON_FindNextFileLFN)
#define FAT_flength (pluginLib->DRAGON_flength)
#define FAT_DiscType (pluginLib->DRAGON_DiscType)

#define scanKeys (pluginLib->scanKeys)
#define keysHeld (pluginLib->keysHeld)
#define keysDown (pluginLib->keysDown)
#define keysDownRepeat (pluginLib->keysDownRepeat)
#define keysSetRepeat (pluginLib->keysSetRepeat)
#define keysUp (pluginLib->keysUp)
#define touchReadXY (pluginLib->touchReadXY)

#define swiWaitForVBlank (pluginLib->swiWaitForVBlank)

#define connectWifi (pluginLib->connectWifi)
#define disconnectWifi (pluginLib->disconnectWifi)
#define wifiEnabled (pluginLib->isConnected)
#define Wifi_AssocStatus (pluginLib->Wifi_AssocStatus)
#define ipToLong (pluginLib->ipToLong)
#define wifiConnect (pluginLib->wifiConnect)
#define wifiConnectIP (pluginLib->wifiConnectIP)
#define sendHTTPRequest (pluginLib->sendHTTPRequest)	
#define setBlocking (pluginLib->setBlocking)
#define setNonBlocking (pluginLib->setNonBlocking)
#define sendData (pluginLib->sendData)
#define recvData (pluginLib->recvData)
#define closesocket (pluginLib->close)

#define Wifi_DisableWifi (pluginLib->Wifi_DisableWifi)
#define Wifi_EnableWifi (pluginLib->Wifi_EnableWifi)
#define Wifi_SetPromiscuousMode (pluginLib->Wifi_SetPromiscuousMode)
#define Wifi_ScanMode (pluginLib->Wifi_ScanMode)
#define Wifi_SetChannel (pluginLib->Wifi_SetChannel)
#define Wifi_GetNumAP (pluginLib->Wifi_GetNumAP)
#define Wifi_GetAPData (pluginLib->Wifi_GetAPData)
#define Wifi_FindMatchingAP (pluginLib->Wifi_FindMatchingAP)
#define Wifi_ConnectAP (pluginLib->Wifi_ConnectAP)
#define Wifi_DisconnectAP (pluginLib->Wifi_DisconnectAP)
#define Wifi_GetIP (pluginLib->Wifi_GetIP)
#define Wifi_GetIPInfo (pluginLib->Wifi_GetIPInfo)
#define Wifi_SetIP (pluginLib->Wifi_SetIP)
#define Wifi_GetData (pluginLib->Wifi_GetData)
#define Wifi_GetStats (pluginLib->Wifi_GetStats)
#define Wifi_RawTxFrame (pluginLib->Wifi_RawTxFrame)
#define Wifi_RawSetPacketHandler (pluginLib->Wifi_RawSetPacketHandler)
#define Wifi_RxRawReadPacket (pluginLib->Wifi_RxRawReadPacket)
#define gethostbyname (pluginLib->gethostbyname)
#define socket (pluginLib->socket)
#define bind (pluginLib->bind)
#define connect (pluginLib->connect)
#define send (pluginLib->send)
#define recv (pluginLib->recv)
#define sendto (pluginLib->sendto)
#define recvfrom (pluginLib->recvfrom)
#define listen (pluginLib->listen)
#define accept (pluginLib->accept)
#define shutdown (pluginLib->shutdown)
#define setsockopt (pluginLib->setsockopt)
#define getsockopt (pluginLib->getsockopt)
#define getpeername (pluginLib->getpeername)
#define getsockname (pluginLib->getsockname)
#define htons (pluginLib->htons)
#define htonl (pluginLib->htonl)
#define select (pluginLib->select)

#define libfb_swapBuffers (pluginLib->libfb_swapBuffers)
#define libfb_swapBuffer0 (pluginLib->fb_swapBuffers)
#define libfb_swapBuffer1 (pluginLib->bg_swapBuffers)
#define libfb_getDrawSurface (pluginLib->libfb_getDrawSurface)
#define libfb_setBGColor (pluginLib->libfb_setBGColor)
#define libfb_setPixel (pluginLib->libfb_setPixel)
#define libfb_dispSprite (pluginLib->libfb_dispSprite)
#define libfb_dispRect (pluginLib->libfb_dispRect)
#define libfb_dispBox (pluginLib->libfb_dispBox)

#define libfb_setCursorPos (pluginLib->setCursorPos)
#define libfb_setCursorOVR (pluginLib->setCursorOVR)
#define libfb_setCursorINS (pluginLib->setCursorINS)
#define libfb_setCursorProperties (pluginLib->setCursorProperties)
#define libfb_getPositionAbove (pluginLib->getPositionAbove)
#define libfb_getPositionBelow (pluginLib->getPositionBelow)
#define libfb_setCallBack (pluginLib->setCallBack)
#define libfb_clearCallBack (pluginLib->clearCallBack)
#define libfb_setTwoPasEnabled (pluginLib->setTwoPasEnabled)
#define libfb_showCursor (pluginLib->showCursor)
#define libfb_hideCursor (pluginLib->hideCursor)

#define libfb_setClipping (pluginLib->libfb_setClipping)
#define libfb_setWrapToBorder (pluginLib->setWrapToBorder)
#define libfb_setWrapNormal (pluginLib->setWrapNormal)
#define libfb_setColor (pluginLib->setColor)
#define libfb_setFont (pluginLib->libfb_setFont)
#define libfb_setBold (pluginLib->setBold)
#define libfb_setItalics (pluginLib->setItalics)
#define libfb_setUnderline (pluginLib->setUnderline)
#define libfb_getStringWidth (pluginLib->libfb_getStringWidth)
#define libfb_getWrapPoints (pluginLib->libfb_getWrapPoints)
#define libfb_dispString (pluginLib->libfb_dispString)
#define libfb_dispChar (pluginLib->libfb_dispChar)

// specific to DSO
#define loadSound (pluginLib->loadSound)
#define startSoundStream(w, x, y, z) (pluginLib->startSoundStream)(pluginUniqueID, w, x, y, z)
#define pauseSound (pluginLib->pauseSound)
#define getSoundLoc (pluginLib->getSoundLoc)
#define setSoundLoc (pluginLib->setSoundLoc)
#define closeSound (pluginLib->closeSound)
	
#define getState (pluginLib->getState)
#define getSourceFmt (pluginLib->getSourceFmt)
#define getCurrentStatus (pluginLib->getCurrentStatus)
#define getVolume (pluginLib->getVolume)
#define setVolume (pluginLib->setVolume)
	
#define separateExtension (pluginLib->separateExtension)
#define abbreviateString (pluginLib->pluginAbbreviateString)
#define centerOnPt (pluginLib->pluginCenterOnPt)
#define launchNDSFile (pluginLib->launchNDS)
#define launchNDSFileAlt (pluginLib->launchNDSAlt)
#define pluginGetCurrentScreen (pluginLib->pluginGetCurrentScreen)
#define checkSleepState (pluginLib->checkSleepState)
#define writeDebug (pluginLib->writeDebug)
#define sendPSGCommand (pluginLib->sendPSGCommand)

#define drawHome (pluginLib->drawHome)
#define drawTimeDate (pluginLib->drawTimeDate)
#define drawButtonTexts (pluginLib->drawButtonTextsEX)
#define displayScrollHandle (pluginLib->displayScrollHandle)
#define drawScrollBar (pluginLib->drawScrollBarEX)
#define drawListBox (pluginLib->drawListBox)
#define drawLR (pluginLib->drawLREX)
#define getScroll (pluginLib->getScroll)
#define getCursorFromTouch (pluginLib->getCursorFromTouch)
	
#endif

